<template>
  <Layout>
    <div class="main-container" v-loading="loading">
      <BlogDetail :blog="data" v-if="data"/>
    </div>
    <template #right>
      <div class="right-container">
        <BlogTOC :toc="data.toc" v-if="data"/>
      </div>
    </template>
  </Layout>
</template>

<script>

import getData from "@/mixins/getData";
import {getBlogById} from "@/api/blog/blog";
import Layout from "@/components/Layout/index.vue";
import BlogDetail from "@/views/Blog/components/BlogDetail.vue";
import BlogTOC from "@/views/Blog/components/BlogTOC.vue";

export default {
  name: "Detail",
  components: {BlogTOC, BlogDetail, Layout},
  mixins: [getData(null)],
  methods: {
    async getData() {
      return await getBlogById(this.$route.params.id)
    }
  }
}
</script>

<style scoped lang="less">
.main-container{
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
.right-container{
  width: 300px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 20px;
}
</style>